<template>
    <div>
        <el-table
            :data='tableData'
            border
            class='table'
            ref='multipleTable'
            header-cell-class-name='table-header'
        >
            <el-table-column label='提交ID' width='80px'>
                <template #default='scope'>
                    {{ scope.row.id }}
                </template></el-table-column>
            <el-table-column prop='language' label='语言' width='80px'></el-table-column>
            <el-table-column label='状态' align='center'>
                <template #default='scope'>
                    <el-tag
                        :type="
                                scope.row.state === 'Accepted'
                                    ? 'success'
                                    : 'danger'
                            "
                    >
                        {{ scope.row.state }}
                    </el-tag>
                </template>
            </el-table-column>
<!--            <el-table-column  label='提交时间'>-->
<!--                <template #default='scope'>-->
<!--                    {{ dates.format(scope.row.gmtCreate,'yyyy-MM-dd')}}-->
<!--                </template>-->
<!--            </el-table-column>-->
        </el-table>
    </div>
</template>

<script>
// import CodeDetail from '@/components/common/CodeDetail';

export default {
    name: 'SubmitHistory',
    props: ['id'],
    data() {
        return {
            tableData: [],
            username: '',
            // getId: this.props.id
        };
    },
    mounted: function(){
        // console.log(this.id)
        this.load_status()
    },
    methods: {
        load_status() {
            const username = localStorage.getItem("ms_username")
            let _this = this
            // console.log(_this.id)
            // console.log(1)
            this.$axios.get('/status/' + username + '/' + _this.id +  '/personAndID').then(resp => {
                if(resp && resp.status === 200) {
                    _this.tableData = resp.data.slice(0, 5)
                }
            })
        }
    },
    components: {
        // CodeDetail
    }
};
</script>

<style scoped>
a{
    text-decoration: underline;
}
</style>
